home *** CD-ROM | disk | FTP | other *** search
- #!/usr/local/bin/perl
-
- require "cgilib.pl";
-
- print "\n";
- print "This simple utility script takes a set of key/value pairs\n";
- print "and returns a CGI encoded equivilent.\n";
- print "Enter pairs of the form key=value.\n";
- print "Input will stop when you enter a blank line.\n";
- print "\n";
-
- $returnString = "";
-
- #Loop over the input
- while(<STDIN>)
- {
- if(/^$/)
- {
- last;
- }
-
- #Get rid of the new-line character
-
- chop;
-
- $key = "";
- $value = "";
-
- # Break apart the key and value
-
- ($key,$value) = split("=",$_);
-
- #Add the & if this is not the first pair
-
- if($returnString ne "")
- {
- $returnString .= "&";
- }
-
- # Append the encoded key and value
-
- $returnString .= &encodeData($key);
- $returnString .= "=";
- $returnString .= &encodeData($value);
-
- }
-
- print "The encoded string has: ",length($returnString)," characters\n\n";
- print $returnString,"\n";
- 1;
-